package me.zhengjie.modules.web.enums;

public enum PriceSettingKeyEnum {

    Month_1("Month_1",30),
    Month_3("Month_3",90),
    Month_6("Month_6",180),
    Month_12("Month_12",365),
    ;

    private String key;

    private Integer day;

    public String getKey() {
        return key;
    }

    public Integer getDay() {
        return day;
    }

    PriceSettingKeyEnum(String key, Integer day){
        this.key = key;
        this.day = day;
    }

    public static Integer getDayByKey(String key){
        PriceSettingKeyEnum[] values = PriceSettingKeyEnum.values();
        for (PriceSettingKeyEnum settingKeyEnum : values){
            if(settingKeyEnum.getKey().equals(key)){
                return settingKeyEnum.getDay();
            }
        }
        return PriceSettingKeyEnum.Month_1.getDay();
    }
}
